#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    // 指针面前一定加上类作用说明符，说明指针指向哪个类的成员函数
    void(Widget::* signal_p)(QString) = &Widget::mySignal;
    void(Widget::* slot_p)(QString) = &Widget::mySlot;

    connect(this, signal_p, this, slot_p);
    emit mySignal("11");
}

Widget::~Widget()
{
    delete ui;
}

void Widget::mySlot()
{
    this->setWindowTitle("无参数");
}

void Widget::mySlot(QString)
{
    this->setWindowTitle("有参数");
}
